home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Languages / Oberon⁄F™ 1.1 / Obx / Mod / Dialog (.txt) < prev    next >
Encoding:
Oberon Document  |  1996-01-05  |  3.8 KB  |  113 lines  |  [oODC/obnF]

  1. Documents.StdDocumentDesc
  2. Documents.DocumentDesc
  3. Containers.ViewDesc
  4. Views.ViewDesc
  5. Stores.StoreDesc
  6. Documents.ModelDesc
  7. Containers.ModelDesc
  8. Models.ModelDesc
  9. Stores.ElemDesc
  10. TextViews.StdViewDesc
  11. TextViews.ViewDesc
  12. TextModels.StdModelDesc
  13. TextModels.ModelDesc
  14. TextModels.AttributesDesc
  15. Helvetica
  16. Helvetica
  17. Helvetica
  18. MODULE ObxDialog;
  19.     IMPORT Dialog;
  20.     TYPE
  21.         Enumeration* = RECORD (Dialog.Enumeration) END;
  22.         Selection* = RECORD (Dialog.Selection) END;
  23.         Combo* = RECORD (Dialog.Combo) END;
  24.         dialog*: RECORD (Dialog.Interactor)
  25.             list*: Enumeration;
  26.             sel*: Selection;
  27.             combo*: Combo;
  28.             sum-: LONGINT;
  29.             disable*: BOOLEAN;
  30.             elems*: INTEGER;
  31.             A*, B*: PROCEDURE;
  32.         END;
  33.     PROCEDURE NumToString (i: LONGINT; VAR str: Dialog.String);
  34.     BEGIN
  35.         CASE i OF
  36.         | 0: str := "zero"
  37.         | 1: str := "one"
  38.         | 2: str := "two"
  39.         | 3: str := "three"
  40.         | 4: str := "four"
  41.         | 5: str := "five"
  42.         | 6: str := "six"
  43.         | 7: str := "seven"
  44.         | 8: str := "eight"
  45.         | 9: str := "nine"
  46.         | 10: str := "ten"
  47.         | 11: str := "eleven"
  48.         END
  49.     END NumToString;
  50.     PROCEDURE (VAR e: Enumeration) GetName* (i: LONGINT; VAR name: Dialog.String);
  51.     BEGIN
  52.         IF (i >= 0) & (i < dialog.elems) THEN NumToString(i, name) ELSE name := "" END
  53.     END GetName;
  54.     PROCEDURE (VAR e: Selection) GetName* (i: LONGINT; VAR name: Dialog.String);
  55.     BEGIN
  56.         IF (i >= 0) &  (i < 12) THEN NumToString(i, name) ELSE name := "" END
  57.     END GetName;
  58.     PROCEDURE (VAR e: Combo) GetName* (i: LONGINT; VAR name: Dialog.String);
  59.     BEGIN
  60.         IF (i >= 0) &  (i < 12) THEN NumToString(i, name) ELSE name := "" END
  61.     END GetName;
  62.     PROCEDURE SelNotify* (op, from, to: LONGINT);
  63.     (* op = changed set element *)
  64.     BEGIN
  65.         IF op = Dialog.set THEN
  66.             dialog.sum := (to - from + 1) * (to + from) DIV 2
  67.         ELSIF op = Dialog.excluded THEN
  68.             WHILE from <= to DO DEC(dialog.sum, from); INC(from) END
  69.         ELSIF op = Dialog.included THEN
  70.             WHILE from <= to DO INC(dialog.sum, from); INC(from) END
  71.         END;
  72.         Dialog.Update(dialog); Dialog.CheckGuards    (* show new dialog.sum *)
  73.     END SelNotify;
  74.     PROCEDURE DisableNotify* (op, from, to: LONGINT);
  75.     BEGIN
  76.         IF op = Dialog.changed THEN Dialog.CheckGuards END    (* reevaluate listbox guard *)
  77.     END DisableNotify;
  78.     PROCEDURE ElemsNotify* (op, from, to: LONGINT);
  79.     BEGIN
  80.         IF op = Dialog.changed THEN
  81.             IF dialog.elems < 0 THEN dialog.elems := 0; Dialog.Update(dialog)
  82.             ELSIF dialog.elems > 12 THEN dialog.elems := 12; Dialog.Update(dialog)
  83.             END;
  84.             Dialog.UpdateList(dialog.list)    (* update list of listbox *)
  85.         END;
  86.         Dialog.CheckGuards
  87.     END ElemsNotify;
  88.     PROCEDURE ListGuard* (VAR par: Dialog.Par);
  89.     BEGIN
  90.         par.disabled := dialog.disable
  91.     END ListGuard;
  92.     PROCEDURE PressNotify* (op, from, to: LONGINT);
  93.     BEGIN
  94.         IF op = Dialog.pressed THEN Dialog.Beep END
  95.     END PressNotify;
  96.     PROCEDURE Dummy*;
  97.     BEGIN    (* empty command *)
  98.     END Dummy;
  99. BEGIN
  100.     dialog.A := Dummy; dialog.B := Dummy; dialog.elems := 6
  101. END ObxDialog.
  102. TextControllers.StdCtrlDesc
  103. TextControllers.ControllerDesc
  104. Containers.ControllerDesc
  105. Controllers.ControllerDesc
  106. TextRulers.StdRulerDesc
  107. TextRulers.RulerDesc
  108. TextRulers.StdStyleDesc
  109. TextRulers.StyleDesc
  110. TextRulers.AttributesDesc
  111. Helvetica
  112. Documents.ControllerDesc
  113.